<template>
  <div class="tag-cloud">
    <router-link 
      v-for="tag in tags" 
      :key="tag.id" 
      :to="`/tag/${tag.id}`" 
      class="tag"
      :style="{ fontSize: `${0.8 + tag.count * 0.2}rem` }"
    >
      {{ tag.name }}
    </router-link>
  </div>
</template>

<script setup>
import { computed } from 'vue'
import { useBlogStore } from '@/stores/blog'

const blogStore = useBlogStore()
const tags = computed(() => blogStore.tags)
</script>

<style scoped>
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag {
  display: inline-block;
  padding: 0.3rem 0.6rem;
  background: #f1f1f1;
  border-radius: 3px;
  color: #34495e;
  text-decoration: none;
  transition: all 0.3s ease;
}

.tag:hover {
  background: #42b983;
  color: white;
}

.router-link-active.tag {
  background: #2c3e50;
  color: white;
}
</style>